package main

import "fmt"

func main() {
	limit := 4000000
	fmt.Println("Sum of even Fib numbers under ", limit, ": ", sumOfEvenFibNumbers(limit))
}

func sumOfEvenFibNumbers(limit int) int {
	i, j, sum := 1, 2, 0
	for j < limit {
		if j%2 == 0 {
			sum += j
		}
		i, j = j, i+j
	}
	return sum
}
